package com.junsi.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.junsi.bean.Role;
import com.junsi.mapper.RoleMapper;

/**
 * 角色Serivce接口实现类
 * @author wkp
 *
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class RoleSerivce implements com.junsi.service.RoleSerivce {
	
	@Autowired
	private RoleMapper roleMapper;
	
	@Override
	public Role findById(Integer id) {
		
		return roleMapper.findById(id);
	}

	@Override
	public List<Role> findByAll() {
		
		return roleMapper.findByAll();
	}

	@Override
	public boolean save(Role role) {
		int i = roleMapper.save(role);
		if(i == 1){
			return true;
		}
		return false;
	}

	@Override
	public boolean update(Role role) {
		int i = roleMapper.update(role);
		if(i == 1){
			return true;
		}
		return false;
	}

	@Override
	public boolean delete(Integer id) {
		int i = roleMapper.delete(id);
		if(i == 1){
			return true;
		}
		return false;
	}

}
